<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>class</title>
</head>
<body>
<script !src="">
    "use strict";

    //ES6 之后引入 class
    class Student{

        constructor(name,age,role) {
            this.name = name;
            this.age = age;
            this.role = role;
        }

        hello(){
            alert("hello : " + this.name + this.age + this.role );
        }
    }

    let zsh = new Student("zsg",12,"student");
    zsh.hello();

    //继承

    class SmallStudent extends Student{ //本质还是原型proto，只是写法符合java程序员
        constructor(name,age,role,grade) {
            super(name,age,role); //与java相似
            this.grade = grade;
        }

        myGrade(){
            alert("MyGrade:" + this.grade);
        }
    }



</script>
</body>
</html>